/*
 * @Date: 2023-01-22 02:17:37
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-23 21:16:45
 * @FilePath: \campus-repair-platform\server\schema\manage\repair_type.js
 */
/**
 * add_schema   添加报修类型
 * update_schema  修改报修类型信息
 */

const joi = require("joi")
const { id } = require("../common")
const pid = joi.string().length(32).error(new Error("pid格式有误"))
const r_type_id = id.error(new Error("维修人员类型有误"))
const name = joi
  .string()
  .min(1)
  .max(30)
  .error(new Error("报修类型名称格式有误"))


exports.add_schema = {
  body: {
    name: name.required(),
    pid: pid,
    r_type_id: r_type_id,
  },
}

exports.update_schema = {
  body: {
    id: id.required(),
    name,
    r_type_id,
  },
}
